package com.lfy.modules.safety.limit;

import lombok.extern.slf4j.Slf4j;

import java.util.Objects;
/**
 * 限流工厂
 *
 * @author <a href="https://www.lvfeiy.top">lvfeiyang</a>
 * @date 2024/4/25 0:57
 */
@Slf4j
public class LimitFactory {
    private volatile static BaseLimit baseLimit;

    public static BaseLimit getInstance() {
        if(Objects.isNull(baseLimit)){
            synchronized (LimitFactory.class){
                if(Objects.isNull(baseLimit)){
//                    baseLimit = new RedisLimit();
                    baseLimit = new limitLocal();
                    log.info("Limit init success");
                }
            }
        }
        return baseLimit;

    }
}
